package cn.ly.net.udp;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;


public class SendDemo1 {
	
	public static void main(String[] args) throws Exception {
		DatagramSocket ds = new DatagramSocket(10010);
		
		//Scanner sc = new Scanner(System.in);
		//用BufferedReader;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		DatagramPacket dp = null;
		while( (line = br.readLine()) != null){
			/*dp = new DatagramPacket(line.getBytes(),
					line.getBytes().length,InetAddress.getByName("192.168.0.103"),10010);*/
			//广播地址，让所有ip接收
			dp = new DatagramPacket(line.getBytes(),
			line.getBytes().length,InetAddress.getByName("192.168.0.255"),10010);
			
			ds.send(dp);
			if(line.indexOf("886") >= 0){
				break;
			}
		}
		
		ds.close();
	}

}
